package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

type DecodeJson struct {
	RequestId string `json:"request_id"`
	Code      int    `json:"code"`
}

func main() {
	data := make(map[string]interface{})
	data["api_name"] = "stock_basic"
	data["token"] = "token"
	bytesData, _ := json.Marshal(data)
	resp, _ := http.Post("http://api.waditu.com", "application/json", bytes.NewReader(bytesData))
	body, _ := ioutil.ReadAll(resp.Body)

	jsonStrByte := []byte(body)
	decodeData := DecodeJson{}
	json.Unmarshal(jsonStrByte, &decodeData)
	fmt.Println(decodeData.RequestId)
	fmt.Println(decodeData.Code)
}
